from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1272613119.9262199
_template_filename='/home/dcrowdy/src/arkaiv/arkaiv/templates/playlistview.mak'
_template_uri='/playlistview.mak'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding=None
_exports = []


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    pass
def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/autohandler', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        c = context.get('c', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u' \n\n<div id="video">\n\n<video src=\'')
        # SOURCE LINE 5
        __M_writer(unicode(c.clips[0]['url']))
        __M_writer(u'\' controls=\'controls\' ontimeupdate="Updatetime()" width=320 height=240></video>\n\n<form name="api">\n<table style="font-size:small">\n<tr>\n<td>Time:</td>\n<td><input name="tfield" cols="8"></textarea></td>\n</tr>\n')
        # SOURCE LINE 14
        __M_writer(u'<tr>\n<td>Output:</td>\n<td><textarea name="ofield" cols="80" rows="1"></textarea></td>\n</tr>\n</table>\n</form>\n')
        # SOURCE LINE 21
        __M_writer(u'\n')
        # SOURCE LINE 23
        __M_writer(u'<table style="font-size:small">\n\n')
        # SOURCE LINE 25
        for clip in c.clips:
            # SOURCE LINE 26
            __M_writer(u'<tr>\n   <td><a onclick=\'ClipPlay("')
            # SOURCE LINE 27
            __M_writer(unicode(clip['url']))
            __M_writer(u'","')
            __M_writer(unicode(clip['name']))
            __M_writer(u'")\'><img src="/images/blank.png"></a></td>\n    <td>')
            # SOURCE LINE 28
            __M_writer(unicode(clip['id']))
            __M_writer(u'</td>\n    <td>')
            # SOURCE LINE 29
            __M_writer(unicode(clip['name']))
            __M_writer(u'</td>\n    <td>')
            # SOURCE LINE 30
            __M_writer(unicode(clip['url']))
            __M_writer(u'</td>\n</tr> \n')
        # SOURCE LINE 33
        __M_writer(u'</table>\n</div>\n\n<script>\n\nvar output = document.api.ofield;\nvar toutput = document.api.tfield;\nvar gototime = document.api.gfield;\nvar myVideo = document.getElementsByTagName(\'video\')[0];\nvar myAudio = document.getElementsByTagName(\'audio\')[0];\n\nif (myAudio) {\n//  addOutput("Audio");\n  myMedia = myAudio;\n}\nelse {\n//  addOutput("Video");\n  myMedia = myVideo;\n}\n\nv.addEventListener("seeked", function() { document.getElementsByTagName("video")[0].play(); }, true);\n\nfunction ClipPlay(location, name) {\n  myMedia.src = location\n  myMedia.load();\n  myMedia.play();\n  addOutput(name);\n}\n\nfunction Updatetime() {\n  addToutput(myMedia.currentTime);\n}\n\nfunction addToutput(str) {\n  toutput.value = str;\n}\n\nfunction Gototime(location) {\n  t = getGoto();\n//  addOutput(location + t);\n  myMedia.src = location + t;\n  myMedia.load();\n  myMedia.play();\n}\n\nfunction getGoto() {\n  i = parseInt(gototime.value);\n  return isNaN(i) ? 0 : i;\n}\n\nvar outLines = 0;\n\nfunction addOutput(str) {\n  if (outLines == 0) {\n    output.value = str;\n  } else {\n    output.value = str + "\\n" + output.value;\n  }\n  outLines++;\n  if (outLines == 11) {\n    i = output.value.lastIndexOf("\\n");\n    output.value = output.value.substr(0, i);\n    outLines--;\n  }\n\n}\n</script>\n\n\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


